#include <iostream> // std::cout
#include <cstdlib>
#include <mutex>
#include <functional>
#include <bits/stdc++.h>



int main()
{
    std::mutex l_mutex;
    int x = 0;
    std::function<void()> func = [&x,& l_mutex](){
        std::unique_lock lkd(l_mutex);
        x++;
        std::cout<<std::this_thread::get_id()<<">>:"<<x<<"\n";
    };
    std::vector<std::thread> t_arr;
    for(int i = 0;i<10;i++)
    {
        t_arr.push_back(std::thread(func));
    }
    for(auto & td:t_arr)
    {
        td.join();
    }
}